import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OssGroupVO, OssGroupForm, OssGroupQuery } from '@/api/system/ossGroup/types';

/**
 * 查询oss分组列表
 * @param query
 * @returns {*}
 */

export const listOssGroup = (query?: OssGroupQuery): AxiosPromise<OssGroupVO[]> => {
  return request({
    url: '/system/ossGroup/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询oss分组详细
 * @param groupId
 */
export const getOssGroup = (groupId: string | number): AxiosPromise<OssGroupVO> => {
  return request({
    url: '/system/ossGroup/' + groupId,
    method: 'get'
  });
};

/**
 * 新增oss分组
 * @param data
 */
export const addOssGroup = (data: OssGroupForm) => {
  return request({
    url: '/system/ossGroup',
    method: 'post',
    data: data
  });
};

/**
 * 修改oss分组
 * @param data
 */
export const updateOssGroup = (data: OssGroupForm) => {
  return request({
    url: '/system/ossGroup',
    method: 'put',
    data: data
  });
};

/**
 * 删除oss分组
 * @param groupId
 */
export const delOssGroup = (groupId: string | number | Array<string | number>) => {
  return request({
    url: '/system/ossGroup/' + groupId,
    method: 'delete'
  });
};
